<?php $detail = $this->detail;?>
<div id="element-box">
	<div class="m">
		<div class="subNav">
			<ul>
				<li>
					<div>
						<a title="" href="/admin/category/index"><?php echo $this->translate('admin_category_index_tab')?></a>
					</div>
				</li>
				<li class="active">
					<div>
						<a title="" href="/admin/category/add"><?php echo $this->translate('admin_category_add_tab')?></a>						
					</div>
				</li>				
			</ul>
		</div>
		<?php echo $this->message;?>
		<div class="head-title">
			<h3>
				<span>Quản lý danh mục / Thêm sửa danh mục</span>
			</h3>			
		</div>
		<form class="form-validate" id="item-form" name="adminForm"	method="post" action="">
			<div class="width-100 fltlft">
				<fieldset class="adminform">
					<legend><?php echo $this->translate('admin_form_detail')?></legend>
					<ul class="adminformlist">
						<li>
							<label title="" class="hasTip required" for="jform_title"><?php echo $this->translate('admin_form_title')?></label> 
							<input type="text" size="40" style="width:250px" autofocus="autofocus" class="inputbox required"	value="<?php echo isset($detail['title']) ? $detail['title'] : ''?>" name="jform[title]">
						</li>
						<li>
							<label title="" class="hasTip" for="jform_alias"><?php echo $this->translate('admin_form_alias')?></label> 
							<input type="text" size="40" style="width:250px" class="inputbox required" value="<?php echo isset($detail['alias']) ? $detail['alias'] : ''?>" name="jform[alias]">
						</li>
						<li>
							<label title="" class="hasTip" for="jform_parent_id"><?php echo $this->translate('admin_form_parent')?></label> 
							<select class="inputbox" style="width:258px" name="jform[parent_id]">
								<option value="0"><?php echo $this->translate('admin_category_parent')?></option>	
								<?php 
								foreach ($this->arrCat as $item) {								
									$beforeHtml = $selected = '';
									for ($idx = 0; $idx < intval($item['level']) ; $idx++) {
										$beforeHtml .= '|— ';									
									}
									$selected = (isset($item['id']) && $item['id'] == $detail['parent_id']) ? 'selected="selected"' : '';
									echo '<option '.$selected.' value="'.$item['id'].'">'. $beforeHtml . $item['title'] .'</option>';		
								 } ?>							
							</select>
						</li>
						<li>
							<label title="" class="hasTip" for="jform_published"><?php echo $this->translate('admin_form_status')?></label> 
							<select size="1" class="inputbox" style="width:258px" name="jform[published]">
								<option <?php (isset($detail['active']) && $detail['active'] == 1) ? 'selected="selected"' : '' ?> value="1"><?php echo $this->translate('admin_form_published')?></option>
								<option <?php (isset($detail['active']) && $detail['active'] == 0) ? 'selected="selected"' : '' ?> value="0"><?php echo $this->translate('admin_form_unpublished')?></option>								
							</select>
					   	</li>		
					</ul>
					<div class="clr"></div>
					<label title="" class="hasTip" for="jform_description"><?php echo $this->translate('admin_form_description')?></label>
					<div class="clr"></div>
					<textarea id="editor" rows="0"	cols="0" name="jform[description]"><?php echo isset($detail['description']) ? $detail['description'] : ''?></textarea>
					<div class="toggle-editor">
						<div class="buttonList">
							<button value="save" title="save" type="submit" name="btnSave"><?php echo $this->translate('admin_form_save')?></button>
							<button value="cancel" title="cancel" type="submit" name="btnCancel"><?php echo $this->translate('admin_form_cancel')?></button>
						</div>
					</div>
				</fieldset>
			</div>
			<div class="clr"></div>	
			<input type="hidden" name="jform[id]" value="<?php echo $detail['id'] ?>" />	
			<input type="hidden" name="jform[token]" value="<?php echo base64_encode(session_id())?>" />		
		</form>

		<div class="clr"></div>
	</div>
</div>
